<template>
  <div>
    <div class="combox" v-if="Mycollection">
      <div class="container">
        <div class="toplogo">
          <button class="comebreak" @click="$router.go(-1)">
            <div class="left iconfont icon-arrow-left-bold"></div>
          </button>
          <p style="font-weight: bold; font-size: 16px">我的收藏 ({{Mycollection.length}})</p>
          <p style="width: 28px"></p>
        </div>
        <div class="box_foot_lists" v-if="Mycollection">
                <ul>
                  
                    <div v-for="(item,index) in Mycollection" :key="index">
                      <router-link :to="'/details?id='+item.id" tag="li">
                        <div class="titlebox">
                            <div class="title">{{item.title}}</div>
                            <div class="subtitle">
                                <!-- 存在video数据或者有hot数据的加上con类名 -->
                                <div :class="[{'con':item.video || item.hot}]">{{item.video}}{{item.hot}}</div>
                                <div>{{item.name}} {{item.time}}小时前</div>
                            </div>
                        </div>
                        <div class="imgbox">
                            <img :src="item.img" alt="" class="auto-img">
                        </div>
                      </router-link>
                    </div>
                  
                    
                </ul>
        </div>
       <van-empty v-show="Mycollection.length==0" description="暂无内容哦~" />
      </div>
      
    
    </div>
  </div>
</template>

<script>
import "../assets/font/iconfont.js";
export default {
  data() {
    return {
        Mycollection:[]
    };
  },
  created() {
    if (window.localStorage.getItem("my")) {
          this.Mycollection = JSON.parse(window.localStorage.getItem("my"))[0];
        }
  },
};
</script>

<style lang="scss" scoped>
.combox {
  
  .box_foot_lists {
    padding: 0 13px;
    margin-bottom: 10px;
    ul {
      li {
        margin-top: 20px;
        padding-bottom: 15px;
        border-bottom:1px solid #ccc ;
        display: flex;
        justify-content: space-between;
        .titlebox {
          margin-right: 20px;
          flex: 1;
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          .title {
            font-weight: bold;
            margin-bottom: 16px;
            font-size: 15px;
          }
          .subtitle {
            display: flex;
            align-items: center;
            margin-left: -2px;
            div{
              color: #747474;
              font-weight: bold;
              font-size: 12px;
              transform: scale(0.9);
              margin-left: -1px;
              &.con {
                border: 1px solid red;
                border-radius: 5px;
                color: red;
                font-size: 12px;
                font-weight: bold;
                padding: 2px;
              
              }
            }
          }
        }
        .imgbox {
          flex: 0.6;
          border-radius: 6px;
          overflow: hidden;
        }
      }
    }
  }
  .toplogo {
    height: 40px;
    // margin-bottom: 40px;
    padding: 0 13px 0 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background-color: #fff;
    text-align: center;
    z-index: 99;
    .left {
      width: 7.5%;
      height: 40px;
      line-height: 40px;
      font-size: 28px;
    }
    p {
      justify-content: center;
    }
  }
   .pagebtm {
    height: 50px;
    padding: 0 4px;
    background-color: #fff;
    box-shadow: 0px 0px 12px 1px #ccc;
    display: flex;
    align-items: center;
    position: fixed;
    bottom: 0;
    min-width: 375px;
    max-width: 750px;
    width: 100%;
    .icon-inp {
      width: 13.3%;
      // height: 20px;
      font-size: 20px;
      text-align: center;
    }
    .inp {
      flex: 1;
      border-radius: 15px;
      background-color: #f1f1f1;
      height: 30px;
      margin-right: 2.1%;
      padding: 0 4.5%;
      font-size: 12px;
      color: #999;
      font-weight: bold;
      line-height: 30px;
      outline: none;
      border: 0;
    }
  }
  .usercom {
    margin: 0 13px;
    padding-bottom: 40px;
    .userbox {
      margin: 13px 0;
      .top {
        height: 32px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        .right {
          display: flex;
          font-size: 12px;
          align-items: center;
          .like {
            font-size: 20px;
            margin-left: 5px;
          }
        }
      }
      .userimg {
        width: 32px;
        height: 32px;
        border-radius: 50%;
      }
      .btm {
        .reply {
          display: flex;
          font-size: 12px;
          color: #aeaeae;
          .time {
            margin-right: 15px;
          }
          .replybox {
            width: 35px;
            height: 15px;
            padding: 1px;
            text-align: center;
            line-height: 15px;
            border-radius: 5px;
            background-color: #f6f6f6;
            color: #d95546;
          }
        }
        .usercomment {
          font-size: 14px;
        }
      }
      .user {
        font-size: 12px;
        display: flex;
        align-items: center;
      }
    }
    .allcom {
      width: 100%;
      height: 40px;
      background-color: #f1f1f1;
      border-radius: 17px;
      font-size: 14px;
      font-weight: bold;
      text-align: center;
      line-height: 40px;
      color: #636363;
    }
  }
  .icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: currentColor;
    overflow: hidden;
  }
}
.combox .box_foot,
.combox .comment {
  margin: 0 13px;
}
.combox .box_foot > .titlebox,
.combox .comment > .titlebox {
  display: flex;
  margin-top: 20px;
  font-size: 15px;
  font-weight: bold;
}
.combox .box_foot > .titlebox > .icon1,
.combox .comment > .titlebox > .icon1 {
  width: 20px;
  height: 20px;
  margin-right: 5px;
}
.combox {
  .van-share-sheet ::v-deep .van-share-sheet__options {
    display: flex;
    justify-content: space-between;
    padding: 16px 0;
  }
  .van-popup {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    // padding: 20px;
    textarea {
      border: 0;
      background-color: #f1f1f1;
      border-radius: 15px;
      padding: 20px;
      width: 80%;
      height: 30%;
      resize: none;
      font-size: 14px;
      font-weight: bold;
    }
    .send {
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 15px;
      font-size: 16px;
      font-weight: bold;
      color: #fff;
      width: 80%;
      padding: 15px 20px;
      margin-top: 20px;
      height: 5%;
      background: rgb(29, 153, 229);
    }
  }
}
</style>